//
// Created by Jisam on 2024/8/13 22:46.
// solve a
#include <bits/stdc++.h>

#define endl "\n"
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define u32 unsigned
#define i64 long long
#define u64 unsigned long long

using namespace std;


void solve() {
    string s;
    cin >> s;
    int ok = 1;
//    cout << s[0] <<" " << s[1] <<" " << s[2] <<" "<< s.length() <<" \n";
    if(s[0] != '1' || s[1] != '0') {
        ok = 0;
    }
    if( s.length() <=  3){
        if(s[2] - '0' <= 1 ) ok = 0;
    }else{
        if(s[2] == '0') ok = 0;
    }

    if(ok) cout << "YES\n";
    else cout << "NO\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) solve();
//    cout << "\n"[];
    return 0;
}